import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TLadderCareer } from "../../../Message/Db/Tables/TLadderCareer";
import { ItemData } from "./info/ItemData";
import { SkillConfig } from "./SkillConfig";
type int = number;
//class LadderCareerConfig
    
    export  class LadderCareerConfig
    {
        constructor()
        {
            
            var loc1=ConfigManager.instance.getJSONByFileName("t_ladder_career.json");
            this._dic = new Map<any, any> /* flash.utils.Dictionary */();
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TLadderCareer();
                loc1.career = loc2.career;
                loc1.hitRate = loc2.hitRate;
                loc1.id = loc2.id;
                loc1.joukRate = loc2.joukRate;
                loc1.level = loc2.level;
                loc1.magicDefense = loc2.magicDefense;
                loc1.maxLife = loc2.maxLife;
                loc1.maxMana = loc2.maxMana;
                loc1.name = loc2.name;
                loc1.passRate = loc2.passRate;
                loc1.physicalAttack = loc2.physicalAttack;
                loc1.physicalCritRate = loc2.physicalCritRate;
                loc1.physicalDefense = loc2.physicalDefense;
                loc1.reliefRate = loc2.reliefRate;
                loc1.runeList = loc2.runeList;
                loc1.skillList = loc2.skillList;
                loc1.toughnessRate = loc2.toughnessRate;
                loc1.wuXingFightValue = loc2.wuXingFightValue;
                loc1.wuXingKind = loc2.wuXingKind;
                this._dic[loc1.career] = loc1;
            }
            return;
        }

        /* internal  */getItemByCareer(arg1: int): TLadderCareer
        {
            return this._dic[arg1] as TLadderCareer;
        }

        public getRuneListByCareer(arg1: int): Array<any>
        {
            var loc4=0;
            var loc1=[];
            var loc2=this.getItemByCareer(arg1).runeList;
            var loc3;
            var loc5=((loc3 = loc2.split("#")).length - 1);
            while (loc4 < loc5) 
            {
                loc1.push(new ItemData(int(loc3[loc4])));
                ++loc4;
            }
            return loc1;
        }

        public getSkillListByCareer(arg1: int): Array<any>
        {
            var loc4=0;
            var loc1=[];
            var loc2=this.getItemByCareer(arg1).skillList;
            var loc3;
            var loc5=((loc3 = loc2.split("#")).length - 1);
            while (loc4 < loc5) 
            {
                loc1.push(SkillConfig.instance.getInfoByName(int(loc3[loc4])));
                ++loc4;
            }
            return loc1;
        }

        public static get instance(): LadderCareerConfig
        {
            if (!LadderCareerConfig._instance) 
            {
                LadderCareerConfig._instance = new LadderCareerConfig();
            }
            return LadderCareerConfig._instance;
        }

        /* internal */ /* var */_dic: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: LadderCareerConfig;
    }
